import { PetNewBaseView } from "./PetNewBaseView";
import { Language } from "../../../../extend/language/Language";
import { PetBatchRefineWindow } from "./PetBatchRefineWindow";
import { GameController } from "../../mvc/GameController";
import { BaseWindow } from "../../../component/window/BaseWindow";
import { ShopConfig } from "../../resource/ShopConfig";
import { ECategory } from "../../../../Message/Public/ECategory";
import { EProp } from "../../../../Message/Public/EProp";
import { ShopRule } from "../../rules/ShopRule";
import { ObjCreate } from "../common/ObjCreate";
import { ImagesConst } from "../../resource/ImagesConst";
import { GImageBitmap } from "../../../../com/mui/controls/GImageBitmap";
import { PetAttrPanel } from "./PetAttrPanel";
import { GlobalStyle } from "../../../common/global/GlobalStyle";
import { GTextFormat } from "../../../common/GTextFormat";
import { FontUtil } from "../../../common/font/FontUtil";
import { PetUpgradeTipPanel } from "./PetUpgradeTipPanel";
import { BaseItem } from "../common/BaseItem";
import { HTMLUtil } from "../../../../com/gengine/utils/HTMLUtil";
import { BaseProgressBar } from "../common/BaseProgressBar";
import { PetTileListPanel } from "./PetTileListPanel";
import { PublicMessageConfig } from "../../resource/PublicMessageConfig";
import { SPetInfo } from "../../../../Message/Game/SPetInfo";
import { Cache } from "../../cache/Cache";
import { PetForgeItemUpdate } from "../petForge/PetForgeItemUpdate";
import { PetForgeType } from "../petForge/PetForgeType";
import { PetColor } from "./info/PetColor";
import { PetUtil } from "./info/PetUtil";
import { LoaderHelp } from "../../../common/display/LoaderHelp";
import { ResFileConst } from "../../resource/ResFileConst";
import { SWFPlayer } from "../../scene/modle/SWFPlayer";
import { ModelType } from "../../scene/modle/data/ModelType";
import { SMoney } from "../../../../Message/Game/SMoney";
import { ItemData } from "../../resource/info/ItemData";
import { EBind } from "../../../../Message/Public/EBind";
import { FilterConst } from "../../../component/gconst/FilterConst";
import { BuyAlert } from "./BuyAlert";
import { Dispatcher } from "../../../mvc/core/Dispatcher";
import { DataEvent } from "../../events/DataEvent";
import { EventName } from "../../mvc/EventName";
import { PetShareObject } from "./info/PetShareObject";
import { Alert } from "../../../../com/mui/controls/Alert";
import { MsgManager } from "../../manager/MsgManager";
import { QuickBuyWindow } from "../common/QuickBuyWindow";
import { PetEventName } from "./PetEventName";
import { EffectManager } from "../../manager/EffectManager";
import { SVIPInfo } from "../../../../Message/Game/SVIPInfo";
import { VIPUtil } from "../vip/VIPUtil";
import { PetSoulLevelTipPanel } from "./PetSoulLevelTipPanel";
import { ShopItemInfo } from "../../resource/info/ShopItemInfo";
import { TPetUpgrage } from "../../../../Message/Db/Tables/TPetUpgrage";
import { GTextInput } from "../../../../com/mui/controls/GTextInput";
import { GButton } from "../../../../com/mui/controls/GButton";
import { GCheckBox } from "../../../../com/mui/controls/GCheckBox";
import { PetModelPanel } from "./PetModelPanel";
import { _petInfo } from "../../../../this/_petInfo";
import { _blessLevel } from "../../../../this/_blessLevel";
type int = number;
//class PetRefinePanel
    
    export  class PetRefinePanel extends PetNewBaseView
    {
        constructor()
        {
            super();
            this._attrValueArray = [];
            this._fightAttrLabelArray = Language.getString(54553).split(",");
            return;
        }

        /* internal  */onBatchBtnClickHandler(arg1: Object /* flash.events.MouseEvent */): void
        {
            if (this._batchWindow == null) 
            {
                this._batchWindow = new PetBatchRefineWindow();
                this._batchWindow.layer = GameController.pet.view as BaseWindow;
                this._batchWindow.getCb().addEventListener(flash.events.Event.CHANGE, this.onBatchCbChangeHandler);
            }
            this._batchWindow.updateBySPetInfo(this._petInfo);
            this._batchWindow.updateCostProp(this._costProp);
            this.updateMaterial();
            this._batchWindow.show();
            return;
        }

        protected /* override */ init(): void
        {
            this._costProp = ShopConfig.instance.getItemByType(ECategory._ECategoryProp, EProp._EPropPetGrowUpMaterial, 1, -1, true, ShopRule.ShopMallPet);
            ObjCreate.createFlowerBg(0, 0, 582, 303, this);
            ObjCreate.createBg(0, 305, 582, 95, this);
            ObjCreate.createBg(100, 5, 160, 25, this, ImagesConst.TileBg);
            this._titleBitmap = new Object /* flash.display.Bitmap */();
            this._titleBitmap.x = 110;
            this._titleBitmap.y = 10;
            this.addChild(this._titleBitmap);
            this._nameTxt = ObjCreate.createTextField("", 150, 10, 150, 20, this);
            this._nameTxt.autoSize = flash.text.TextFieldAutoSize.LEFT;
            ObjCreate.createBg(10, 33, 160, 170, this);
            this.addChild(new GImageBitmap("PetCurrentLabel.png", 0, 30));
            this._currentFightAttrPanel = new PetAttrPanel(this._fightAttrLabelArray, GlobalStyle.textFormat4);
            this._currentFightAttrPanel.x = 20;
            this._currentFightAttrPanel.y = 62;
            this.addChild(this._currentFightAttrPanel);
            ObjCreate.createBg(180, 33, 160, 170, this);
            this.addChild(new GImageBitmap("PetNextLabel.png", 172, 30));
            this._nextFightAttrPanel = new PetAttrPanel(this._fightAttrLabelArray, GlobalStyle.textFormat4);
            this._nextFightAttrPanel.x = 190;
            this._nextFightAttrPanel.y = 62;
            this.addChild(this._nextFightAttrPanel);
            this._upSprite = new Object /* flash.display.Sprite */();
            this._upSprite.x = 350;
            this._upSprite.y = 10;
            this.addChild(this._upSprite);
            this._upSprite.addChild(new GImageBitmap("GrowthLabel.png", 0, 7));
            this._growthTxt = ObjCreate.createTextField("", 85, 2, 70, 50, this._upSprite, new GTextFormat(FontUtil.songtiName, 20, 6350622, false));
            this._growthTxt.autoSize = flash.text.TextFieldAutoSize.LEFT;
            this._upgradeTipPanel = new PetUpgradeTipPanel();
            this._upgradeTipPanel.x = 128;
            this._upgradeTipPanel.y = 0;
            this._upSprite.addChild(this._upgradeTipPanel);
            this._protectTip = ObjCreate.createTextField("", 0, 43, 220, 20, null, GlobalStyle.textFormat6);
            this._protectTip.autoSize = flash.text.TextFieldAutoSize.LEFT;
            this._upSprite.addChild(new GImageBitmap("SoulLevel.png", 0, 40));
            this._soulLevelTxt = ObjCreate.createTextField("", 85, 37, 70, 50, this._upSprite);
            this._soulLevelTxt.addEventListener(flash.events.TextEvent.LINK, this.onSoulLevelTxtClickHandler);
            ObjCreate.createTextField(Language.getString(54299), 0, 70, 100, 20, this._upSprite);
            this._costTxt = ObjCreate.createTextField("", 85, 70, 100, 20, this._upSprite, GlobalStyle.textFormat2);
            this._costTxt.autoSize = flash.text.TextFieldAutoSize.LEFT;
            this._coinBitmap = ObjCreate.createBitmap(ImagesConst.Tongqian_bind_small, 115, 70, this._upSprite);
            this._refineBtn = ObjCreate.createGButton(Language.getString(54294), 145, 35, 70, 26, this._upSprite, "ButtonSpecial");
            this._refineBtn.addEventListener(flash.events.MouseEvent.CLICK, this.onRefineBtnClickHandler);
            this._upSprite.addChild(new GImageBitmap("PetSuccessRate.png", 0, 95));
            this._rateTxt = ObjCreate.createTextField("0%", 85, 92, 200, 50, this._upSprite, new GTextFormat(FontUtil.songtiName, 18, 6350622));
            this._rateTxt.autoSize = flash.text.TextFieldAutoSize.LEFT;
            ObjCreate.createBg(0, 125, 38, 38, this._upSprite, ImagesConst.PackItemBg);
            this._baseItem = new BaseItem();
            this._baseItem.isDragAble = false;
            this._baseItem.width = 32;
            this._baseItem.height = 32;
            this._baseItem.move(2, 127);
            this._upSprite.addChild(this._baseItem);
            ObjCreate.createTextField("×", 50, 136, 20, 20, this._upSprite, new GTextFormat(FontUtil.songtiName, 16, 15859633, true));
            this._numInput = ObjCreate.createGTextInput(75, 132, 55, 23, this._upSprite);
            this._numInput.setStyle("textPadding", 3);
            this._numInput.restrict = "0-9";
            this._numInput.addEventListener(flash.events.Event.CHANGE, this.onNumChangeHandler);
            this._numInput.text = "1";
            this._buyBtn = ObjCreate.createGButton(Language.getString(54295), 155, 135, 50, 20, this._upSprite);
            this._buyBtn.addEventListener(flash.events.MouseEvent.CLICK, this.onBuyBtnClickHandler);
            this._autoBuyCheckBox = ObjCreate.createCheckBox("", 0, 170, 255, 28, this._upSprite);
            this._autoBuyCheckBox.setStyle("textFormat", new GTextFormat(null, 12, 16711680));
            this._autoBuyCheckBox.label = Language.getString(54296);
            this._autoBuyCheckBox.addEventListener(flash.events.Event.CHANGE, this.onThisCbChangeHandler);
            this._blessSprite = new Object /* flash.display.Sprite */();
            this._blessSprite.x = 45;
            this._blessSprite.y = 210;
            this.addChild(this._blessSprite);
            this._blessSprite.addChild(new GImageBitmap("GrowthBless.png", 85, 0));
            this._blessTxt = ObjCreate.createTextField("", 235, -5, 100, 30, this._blessSprite, new GTextFormat(FontUtil.songtiName, 20, 6350622, true));
            this._blessTxt.mouseEnabled = false;
            this._addBtn = ObjCreate.createGButton("", 265, 0, 18, 18, this._blessSprite, "Add2Button");
            this._addBtn.toolTipData = HTMLUtil.addColor(Language.getString(54297), "#ffffff");
            this._addBtn.addEventListener(flash.events.MouseEvent.CLICK, this.onAddBtnClickHandler);
            this._blessBar = new BaseProgressBar(ImagesConst.BlessBarBg);
            this._blessBar.mouseEnabled = false;
            this._blessBar.setLabelPosition(0, 11);
            this._blessBar.progressBarClass = ImagesConst.BlessBar;
            this._blessBar.showProgressText = true;
            this._blessBar.setSize(379, 35);
            this._blessBar.setProgressPosition(18, 14);
            this._blessBar.move(0, 10);
            this._blessSprite.addChild(this._blessBar);
            this._acceptBtn = ObjCreate.createGButton(Language.getString(54298), 450, 15, 70, 24, this._blessSprite);
            this._acceptBtn.addEventListener(flash.events.MouseEvent.CLICK, this.onAcceptBtnClickHandler);
            this._petTileListPanel = new PetTileListPanel(true);
            this._petTileListPanel.x = 0;
            this._petTileListPanel.y = 254;
            this.addChild(this._petTileListPanel);
            super.init();
            updateTip(PublicMessageConfig.instance.getPetForgeTextByName("petRefineDesc"), 10, 310, 85);
            return;
        }

        public /* override */ updateByPetInfo(arg1: SPetInfo): void
        {
            var loc1=null;
            this._petInfo = arg1;
            if (arg1) 
            {
                this._protectValue = Cache.instance.pet.getProtectValue(false, arg1.maxGrowthBlessLevel);
                this._upgradeItemUpdate = PetForgeItemUpdate.getItemUpdate(PetForgeType.petRefine, this._petInfo.strengthenGrowth);
                this._nameTxt.htmlText = PetColor.getColorName(arg1);
                this._growthTxt.htmlText = HTMLUtil.addColor(arg1.growth.toString(), PetUtil.getGrowthTitleColor(arg1.growth));
                this._soulLevelTxt.htmlText = Language.getStringByParam(54610, PetUtil.getGrowthTitleColor(arg1.strengthenGrowth), arg1.strengthenGrowth);
                this._protectTip.text = Language.getStringByParam(54443, this._protectValue);
                this.updateAttrSprite(arg1);
                this.updateByItemUpdateConfig(this._upgradeItemUpdate);
                this.updateBless();
                this.updateMaterial();
                this.onVIPInfoUpdateCommandHandler(null);
                loc1 = GameController.petForge.getShowGrowthBlessWindowPetUid();
                if (loc1 == this._petInfo.uid) 
                {
                    this.onAcceptBtnClickHandler(null);
                }
                this._upgradeTipPanel.updateByPet(true, arg1);
                this._titlePU = this._upgradeTipPanel.titlePU;
                if (this._titlePU) 
                {
                    LoaderHelp.addResCallBack(ResFileConst.petInfo, this.updateBitmap);
                    this._petTileListPanel.selectByGrade(this._titlePU.grade);
                }
                else 
                {
                    this._titleBitmap.bitmapData = null;
                    this._petTileListPanel.selectByGrade(-1);
                }
                if (this._batchWindow && this._batchWindow.isHide == false) 
                {
                    this._batchWindow.updateBySPetInfo(this._petInfo);
                }
            }
            else 
            {
                this.clear();
            }
            return;
        }

        /* internal  */updateBitmap(): void
        {
            this._titleBitmap.bitmapData = PetUtil.getTileBitmap(this._titlePU.grade, true).bitmapData;
            return;
        }

        /* internal  */playEffect(): void
        {
            if (this._effectPlayer == null) 
            {
                this._effectPlayer = new SWFPlayer();
            }
            this._effectPlayer.load("BlessLevelUp.swf", ModelType.NormalSwf, null);
            this._effectPlayer.move(180, 30);
            if (this._blessSprite.contains(this._effectPlayer) == false) 
            {
                this._blessSprite.addChild(this._effectPlayer);
            }
            return;
        }

        /* internal  */stopEffect(): void
        {
            if (this._blessSprite.contains(this._effectPlayer)) 
            {
                this._blessSprite.removeChild(this._effectPlayer);
            }
            return;
        }

        /* internal  */updateAttrSprite(arg1: SPetInfo): void
        {
            var loc2=null;
            var loc1=null;
            if (arg1) 
            {
                this._attrValueArray = [];
                loc1 = arg1.fightAttribute;
                this._attrValueArray.push(loc1.power);
                this._attrValueArray.push(loc1.agile);
                this._attrValueArray.push(loc1.habitus);
                this._attrValueArray.push(loc1.brains);
                this._attrValueArray.push(loc1.spiritual);
                this._currentFightAttrPanel.updateValue(this._attrValueArray);
                this._currentFightAttrPanel.updateAddValue(PetUtil.getGrowthAddValueArray(arg1));
                this._nextFightAttrPanel.updateValue(this._attrValueArray);
                this._nextFightAttrPanel.updateAddValue(PetUtil.getGrowthAddValueArray(arg1, arg1.growth + 1));
                if (this._petInfo.growth >= this._maxGrowth) 
                {
                    this._refineBtn.visible = false;
                }
                else 
                {
                    this._refineBtn.visible = true;
                }
            }
            return;
        }

        /* internal  */updateByItemUpdateConfig(arg1: Object): void
        {
            if (arg1) 
            {
                this._rateTxt.text = arg1.success_rate + "%";
                this._baseRate = int(arg1.success_rate);
                this._unit = int(arg1.unit);
                this._cost = int(arg1.cost);
                this._costTxt.text = this._cost.toString();
                this.onMoneyUpdateHandler(null);
                this._coinBitmap.x = this._costTxt.x + this._costTxt.width + 10;
            }
            return;
        }

        /* internal  */updateBless(): void
        {
            var loc1=null;
            var loc2=null;
            var loc3=null;
            if (this._petInfo) 
            {
                loc1 = PetForgeItemUpdate.getConditionByBlessValue(PetForgeType.petRefine, this._petInfo.growthBless);
                loc2 = loc1["current"];
                loc3 = loc1["next"];
                if (this._petInfo.growthBless < PetForgeItemUpdate.getMiniAbleBless(PetForgeType.petRefine)) 
                {
                    this._blessLevel = 0;
                }
                else 
                {
                    this._blessLevel = int(loc2.goal_value);
                }
                this._blessTxt.htmlText = HTMLUtil.addColor(this._blessLevel.toString(), PetUtil.getGrowthTitleColor(this._blessLevel));
                if (loc3) 
                {
                    this._blessBar.setValue(this._petInfo.growthBless, int(loc3.blessValue));
                }
                else 
                {
                    this._blessBar.setValue(this._petInfo.growthBless, int(loc2.blessValue));
                }
            }
            if (!(this._prePetUid == this._petInfo.uid) || this._preBlessLevel == -1) 
            {
                this._preBlessLevel = this._blessLevel;
            }
            if (this._blessLevel > this._preBlessLevel) 
            {
                if (this._hideTimer == null) 
                {
                    this._hideTimer = new Object /* flash.utils.Timer */(1000);
                    this._hideTimer.repeatCount = 3;
                    this._hideTimer.addEventListener(flash.events.TimerEvent.TIMER_COMPLETE, this.onTimerCompleteHandler);
                }
                this._hideTimer.reset();
                this._hideTimer.start();
                this.playEffect();
            }
            this._preBlessLevel = this._blessLevel;
            this._prePetUid = this._petInfo.uid;
            return;
        }

        /* internal  */onTimerCompleteHandler(arg1: Object /* flash.events.Event */): void
        {
            this._hideTimer.stop();
            this.stopEffect();
            return;
        }

        protected /* override */ onMoneyUpdateHandler(arg1: SMoney=null): void
        {
            if (PetForgeItemUpdate.playerHaveEnoughMoney(this._unit, this._cost)) 
            {
                this._costTxt.textColor = 15859633;
                isMoneyEnough = true;
            }
            else 
            {
                this._costTxt.textColor = 16711680;
                isMoneyEnough = false;
            }
            return;
        }

        protected /* override */ onPackChangeHandler(arg1: Object=null): void
        {
            this.updateMaterial();
            return;
        }

        /* internal  */updateMaterial(): void
        {
            var loc1=0;
            var loc2=null;
            var loc3=null;
            var loc4=null;
            var loc5=null;
            var loc6=0;
            if (this._petInfo) 
            {
                loc2 = new ItemData(this._costProp.itemInfo.item.code);
                loc5 = Cache.instance.pack.backPackCache.getTypeItems(ECategory._ECategoryProp, EProp._EPropPetGrowUpMaterial);
                loc6 = 0;
                while (loc6 < loc5.length) 
                {
                    loc3 = loc5[loc6];
                    loc1 = loc1 + loc3.itemAmount;
                    if (loc3.itemInfo.item.bind == EBind._EBindYes) 
                    {
                        loc4 = loc3;
                    }
                    ++loc6;
                }
                if (loc4 != null) 
                {
                    this._propItemData = loc4;
                }
                else if (loc5 && loc5.length > 0) 
                {
                    this._propItemData = loc5[0];
                }
                else 
                {
                    this._propItemData = null;
                }
                if (this._propItemData != null) 
                {
                    this._numColor = GlobalStyle.color2;
                    isMaterialEnough = true;
                    this._baseItem.filters = [];
                }
                else 
                {
                    this._numColor = GlobalStyle.color7;
                    loc1 = 0;
                    isMaterialEnough = false;
                    this._baseItem.filters = [FilterConst.colorFilter];
                }
                this._baseItem.itemData = loc2;
                this._baseItem.setAmountText(loc1);
            }
            if (this._batchWindow) 
            {
                this._batchWindow.updateAmount(loc1);
            }
            return;
        }

        /* internal  */onNumChangeHandler(arg1: Object /* flash.events.Event */): void
        {
            var loc2=null;
            var loc1=int(this._numInput.text);
            if (loc1 < 1) 
            {
                loc2 = "1";
            }
            else if (loc1 > 99) 
            {
                loc2 = "99";
            }
            else 
            {
                loc2 = loc1 + "";
            }
            this._numInput.htmlText = loc2;
            return;
        }

        /* internal  */onBuyBtnClickHandler(arg1: Object /* flash.events.MouseEvent */): void
        {
            if (this._costProp) 
            {
                this._costProp.buyNum = int(this._numInput.text);
                BuyAlert.showByShopItemInfo(this._costProp);
            }
            return;
        }

        /* internal  */onRefineBtnClickHandler(arg1: Object /* flash.events.MouseEvent */): void
        {
            var e: Object /* flash.events.MouseEvent */;
            var optAble: Boolean;
            var isAutoBuy: Boolean;
            var optStr: string;
            var _mas: Array<any>;
            var isNeedAlert: Boolean;
            var onClickHandler: Function;

            var loc1;
            isAutoBuy = false;
            _mas = null;
            isNeedAlert = false;
            e = arg1;
            optAble = true;
            isAutoBuy = this._autoBuyCheckBox.selected;
            optStr = "";
            _mas = [];
            if (this._petInfo) 
            {
                if (this._petInfo.growth >= this._maxGrowth) 
                {
                    optStr = Language.getString(54300);
                    optAble = false;
                }
                if (!isMoneyEnough) 
                {
                    optStr = Language.getString(54301);
                    optAble = false;
                    Dispatcher.dispatchEvent(new DataEvent(EventName.ShopMallAutoBuyCoin, this._cost));
                }
                if (isAutoBuy == false) 
                {
                    if (!isMaterialEnough) 
                    {
                        optStr = Language.getString(54302);
                        optAble = false;
                    }
                }
                if (this._propItemData) 
                {
                    _mas.push(this._propItemData.uid);
                }
                if (isMaterialEnough) 
                {
                    isAutoBuy = false;
                }
                if (optAble) 
                {
                    isNeedAlert = PetShareObject.isNeedAlert(PetShareObject.GrowthKey);
                    if (isNeedAlert) 
                    {
                        onClickHandler = (arg1: int): void
                        {
                            if (arg1 == Alert.OK) 
                            {
                                Dispatcher.dispatchEvent(new DataEvent(EventName.PetRefreshGrowth, {"uid": _petInfo.uid, "materials": _mas, "isAutoBuy": isAutoBuy}));
                                PetShareObject.save(PetShareObject.GrowthKey);
                            }
                            return;
                        }
                        Alert.show(Language.getStringByParam(54303, this._protectValue), null, Alert.OK | Alert.CANCEL, null, onClickHandler);
                    }
                    else 
                    {
                        Dispatcher.dispatchEvent(new DataEvent(EventName.PetRefreshGrowth, {"uid": this._petInfo.uid, "materials": _mas, "isAutoBuy": isAutoBuy}));
                    }
                }
                else 
                {
                    Dispatcher.dispatchEvent(new DataEvent(EventName.PetStrengThenCant));
                    MsgManager.showRollTipsMsg(optStr);
                    if (!isMaterialEnough) 
                    {
                        if (isAutoBuy == false) 
                        {
                            QuickBuyWindow.instance.updateWindow(ECategory._ECategoryProp, EProp._EPropPetGrowUpMaterial, 1, -1, true, ShopRule.ShopMallPet);
                            QuickBuyWindow.instance.updateDefaultAmount(1);
                            QuickBuyWindow.instance.show();
                        }
                    }
                }
            }
            else 
            {
                Dispatcher.dispatchEvent(new DataEvent(EventName.PetStrengThenCant));
            }
            return;
        }

        /* internal  */onAcceptBtnClickHandler(arg1: Object /* flash.events.MouseEvent */): void
        {
            if (this._petInfo) 
            {
                if (arg1) 
                {
                    if (this._blessLevel <= this._petInfo.strengthenGrowth) 
                    {
                        MsgManager.showRollTipsMsg(Language.getString(54615));
                        return;
                    }
                }
                Dispatcher.dispatchEvent(new DataEvent(PetEventName.PetOpenGrowthBlessWindow, {"petInfo": _petInfo, "blessLevel": _blessLevel}));
            }
            return;
        }

        public guidePetfresh(arg1: Function, arg2: int): void
        {
            var loc1=localToGlobal(new Object /* flash.geom.Point */(this._upSprite.x + this._refineBtn.x, this._upSprite.y + this._refineBtn.y));
            arg1(this._upSprite.x + this._refineBtn.x + this._refineBtn.width, this._upSprite.y + this._refineBtn.y + this._refineBtn.height / 2, this._refineBtn, loc1, arg2);
            return;
        }

        public hideGuide(): void
        {
            EffectManager.glowFilterUnReg(this._refineBtn);
            return;
        }

        protected /* override */ onVIPInfoUpdateCommandHandler(arg1: SVIPInfo): void
        {
            var loc1=0;
            if (Cache.instance.vip.isVIP) 
            {
                loc1 = VIPUtil.getVipPetRefreshRate(Cache.instance.vip.vipInfo.VIPType);
                if (loc1 > 0) 
                {
                    this._rateTxt.text = this._baseRate + "% + " + loc1 + "%（VIP）";
                }
            }
            else 
            {
                this._rateTxt.text = this._baseRate + "%";
            }
            return;
        }

        /* internal  */onAddBtnClickHandler(arg1: Object /* flash.events.MouseEvent */): void
        {
            if (this._petInfo) 
            {
                Dispatcher.dispatchEvent(new DataEvent(PetEventName.PetBlessPropWindowOpen, {"isGrowth": true, "uid": this._petInfo.uid}));
            }
            return;
        }

        /* internal  */onThisCbChangeHandler(arg1: Object /* flash.events.Event */): void
        {
            if (this._batchWindow) 
            {
                this._batchWindow.selectCb(this._autoBuyCheckBox.selected);
            }
            return;
        }

        /* internal  */onBatchCbChangeHandler(arg1: Object /* flash.events.Event */): void
        {
            this._autoBuyCheckBox.selected = this._batchWindow.getCb().selected;
            return;
        }

        /* internal  */onSoulLevelTxtClickHandler(arg1: Object /* flash.events.Event */): void
        {
            if (!this._soulTipPanel) 
            {
                this._soulTipPanel = new PetSoulLevelTipPanel(true);
            }
            if (!this.contains(this._soulTipPanel)) 
            {
                this._soulTipPanel.x = 465;
                this._soulTipPanel.y = 50;
                this.addChild(this._soulTipPanel);
            }
            return;
        }

        /* internal  */clear(): void
        {
            this._nameTxt.text = "";
            this._growthTxt.text = "";
            this._rateTxt.text = "";
            this._blessTxt.text = "";
            this._blessBar.setValue(0, 0);
            return;
        }

        /* internal */ /* var */_vipAddRateTxt: Object /* flash.text.TextField */;

        /* internal */ /* var */_upgradeTipPanel: PetUpgradeTipPanel;

        /* internal */ /* var */_batchWindow: PetBatchRefineWindow;

        /* internal */ /* var */_effectPlayer: SWFPlayer;

        /* internal */ /* var */_soulTipPanel: PetSoulLevelTipPanel;

        /* internal */ /* var */_prePetUid: string;

        /* internal */ /* var */_petInfo: SPetInfo;

        /* internal */ /* var */_attrValueArray: Array<any>;

        /* internal */ /* var */_fightAttrLabelArray: Array<any>;

        /* internal */ /* var */_backupPetUid: string;

        /* internal */ /* var */_backupGrowth: int;

        /* internal */ /* var */_soulLevelTxt: Object /* flash.text.TextField */;

        /* internal */ /* var */_upgradeItemUpdate: Object;

        /* internal */ /* var */_costProp: ShopItemInfo;

        /* internal */ /* var */_propItemData: ItemData;

        /* internal */ /* var */_preBlessLevel: int=-1;

        /* internal */ /* var */_blessLevel: int;

        /* internal */ /* var */_cost: int;

        /* internal */ /* var */_unit: int;

        /* internal */ /* var */_numColor: string="#F1FFB1";

        /* internal */ /* var */_baseRate: int;

        /* internal */ /* var */_protectValue: int;

        /* internal */ /* var */_hideTimer: Object /* flash.utils.Timer */;

        /* internal */ /* var */_titlePU: TPetUpgrage;

        /* internal */ /* var */_upSprite: Object /* flash.display.Sprite */;

        /* internal */ /* var */_blessSprite: Object /* flash.display.Sprite */;

        /* internal */ /* var */_titleBitmap: Object /* flash.display.Bitmap */;

        /* internal */ /* var */_nameTxt: Object /* flash.text.TextField */;

        /* internal */ /* var */_currentFightAttrPanel: PetAttrPanel;

        /* internal */ /* var */_nextFightAttrPanel: PetAttrPanel;

        /* internal */ /* var */_protectTip: Object /* flash.text.TextField */;

        /* internal */ /* var */_growthTxt: Object /* flash.text.TextField */;

        /* internal */ /* var */_rateTxt: Object /* flash.text.TextField */;

        /* internal */ /* var */_baseItem: BaseItem;

        /* internal */ /* var */_numInput: GTextInput;

        /* internal */ /* var */_costTxt: Object /* flash.text.TextField */;

        /* internal */ /* var */_coinBitmap: Object /* flash.display.Bitmap */;

        /* internal */ /* var */_buyBtn: GButton;

        /* internal */ /* var */_autoBuyCheckBox: GCheckBox;

        /* internal */ /* var */_maxGrowth: int=40;

        /* internal */ /* var */_refineBtn: GButton;

        /* internal */ /* var */_batchBtn: GButton;

        /* internal */ /* var */_blessTxt: Object /* flash.text.TextField */;

        /* internal */ /* var */_addBtn: GButton;

        /* internal */ /* var */_blessBar: BaseProgressBar;

        /* internal */ /* var */_acceptBtn: GButton;

        /* internal */ /* var */_petTileListPanel: PetTileListPanel;

        /* internal */ /* var */_petModel: PetModelPanel;

        /* internal */ /* var */_failureTip: Object /* flash.text.TextField */;
    }
